# Maintainer: Jan Alexander Steffens (heftig) <heftig@archlinux.org>
# Contributor: Kevin <kevin@archlinux.org>
# Contributor: criminy <criminy@gmail.com>

pkgbase=cairomm
pkgname=(cairomm cairomm-docs)
pkgver=1.14.3
pkgrel=2
pkgdesc="C++ bindings for Cairo"
url="https://www.cairographics.org/cairomm/"
arch=(x86_64)
license=(LGPL MPL)
depends=(cairo libsigc++)
makedepends=(git meson mm-common)
options=(!emptydirs)
_commit=77a0bac11cc16c66d5292bb2546c1dca3525c918  # tags/1.14.3^0
source=("git+https://gitlab.freedesktop.org/cairo/cairomm.git#commit=$_commit")
sha256sums=('SKIP')

pkgver() {
  cd cairomm
  git describe --tags | sed 's/-/+/g'
}

prepare() {
  cd cairomm
}

build() {
  arch-meson cairomm build -D maintainer-mode=true
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package_cairomm() {
  depends+=(libsigc-2.0.so)
  provides=(libcairomm-1.0.so)

  meson install -C build --destdir "$pkgdir"

  # Split -docs
  mkdir -p docs/usr/share
  mv -t docs/usr/share "$pkgdir"/usr/share/{devhelp,doc}
}

package_cairomm-docs() {
  pkgdesc+=" (documentation)"
  depends=()
  options=(!strip)

  mv -t "$pkgdir" docs/*
}
